
#ifndef BABY_CRYING_WINDOW_H
#define BABY_CRYING_WINDOW_H

#include <QMainWindow>
#include <QString>
#include <QChart>
#include "sound.h"
#include "play.h"
#include <QTimer>
#include <QMouseEvent>
#include "handbookdialog.h"
#include <QFileDialog>
//#include <QXYSeries>
#include <QLineSeries>
#include <QDateTime>
#include <QLabel>

QT_BEGIN_NAMESPACE
namespace Ui { class baby_crying_window; }
QT_END_NAMESPACE

class baby_crying_window : public QMainWindow

{
    Q_OBJECT

public:
    baby_crying_window(QWidget *parent = nullptr);
    ~baby_crying_window();

private slots:


    void on_awake_clicked();

    void on_diaper_clicked();

    void on_hug_clicked();

    void on_hungry_clicked();

    void on_sleepy_clicked();

    void on_uncomfortable_clicked();

    void on_handbook_clicked();

    void on_play_clicked();

    void on_play_process_slider_valueChanged(int value);


    void on_statistic_radio_clicked();

    void on_wave_radio_clicked();

private:
    Ui::baby_crying_window *ui;
    void openfile();
    QString fileName;
    sound s;
    play p;
    enum class play_state
    {
        no_sound, none, playing, pause
    } state = play_state::no_sound;
//    QChartView * MyChartView;   // 画布对象
//    QChart MyChart;             // 图表对象
//    QLineSeries MyLineSeries;   // 展示在图表对象上面的线对象
//    QVector<QPointF> MyPointf;  // 绘制线对象所需要的数据
//    QValueAxis MyAxisX;         // X轴
//    QValueAxis MyAxisY;         // Y轴
    void play(int value);
    QTimer timer_to_show_time, timer_for_playing_process;
    void update_time();
//    void mouseEvent(QMouseEvent *event);
    constexpr static double slider_scale = 1e4;
    QLabel *statistic;
};
#endif // BABY_CRYING_WINDOW_H;
